<?php

// $Id$


require_once($WSC->get_site_inc_dir().'modules/web_site_jabba/jabba_web_page.class.php');
require_once($WSC->get_site_inc_dir().'modules/admin_panel/site_admin_web_page_view.class.php');
require_once($WSC->get_site_inc_dir().'modules/tree_menu_ml/tree_menu_ml_preparer.class.php');
require_once($WSC->get_site_inc_dir().'modules/language_detector_advanced/vl_language_dbc.class.php');



class Site_Admin_Web_Page extends Jabba_Web_Page {
	public function create_view($name = 'default') {
		$ret = new Site_Admin_Web_Page_View($this, $name, 'modules/admin_panel/pages/');

		return $ret;
	}


	public function _run() {
		$ret = parent::_run();

		$session_lifetime = ini_get('session.gc_maxlifetime');

		$ret->set_exported_value('_session_lifetime', $session_lifetime, true);


		return $ret;
	}

	public function init() {
		parent::init();

		$dbc = $this->get_dbc();

		$lang_code = $this->_config->get_current_language();
		$lang_arr = VL_Language_DBC::load_all_languages_ids($dbc);

		if (array_key_exists($lang_code, $lang_arr)) {
			$lang_id = $lang_arr[$lang_code];
		} else {
			$lang_id = 1;
		}


		$html = Tree_Menu_ML_Preparer::prepare_menu($dbc,
												'admin_',
												'navmenu-v',
												$this->_config->get_tpl_dir().'modules/tree_menu/tree_menu.tpl',
												$this->_config->get_scratch_dir().'tpl/menu/',
												$this->_config->get_scratch_dir().'tpl/menu/import/',
												$lang_id,
												$lang_arr
												);



		$this->export('menu', $html);
	}
}

